package com.supermap.dataservice.server.Version;

import com.alibaba.dubbo.config.annotation.Service;
import com.supermap.dataservice.mysql.config.DynamicDataSourceContextHolder;
import com.supermap.dataservice.util.JSONUtils;
import com.supermap.dubbo.api.common.VersionService;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

/**
 * Created by gu on 2019-04-25.
 */
@Service
public class VersionServiceImpl implements VersionService {

    @Resource
    private VersionMapper versionMapper;
    @Override
    public JSONUtils getLatestVersion(String currentPackage) {
        DynamicDataSourceContextHolder.setDataSourceKey("ds2");
        List<Map<String,Object>> list = versionMapper.getLatestVersion(currentPackage);
        return new JSONUtils().setData(list).setCountSum(list != null ? list.size():0);
    }
}
